package com.light.sword

import java.util.*

class HashMapDemo {


    fun test() {
        val map = hashMapOf<String, Int>()
        map["A"] = 1
        map["B"] = 2
        map["C"] = 3
        println(map)

        val treeMap: TreeMap<Int, String> = TreeMap()


    }

}

class Node<K, V> {
    var key: K? = null
    var value: V? = null
    var next: Node<K, V>? = null

    constructor(key: K?, value: V?, next: Node<K, V>?) {
        this.key = key
        this.value = value
        this.next = next
    }

    override fun toString(): String {
        return key.toString() + "=" + value
    }

    override fun hashCode(): Int {
        return Objects.hashCode(key) xor Objects.hashCode(value)
    }

    fun equals(e: Node<K, V>): Boolean {
        if (e === this)
            return true

        if (key == e.key && value == e.value)
            return true

        return false
    }
}


fun main(args: Array<String>) {
    val demo = HashMapDemo()
    demo.test()

}
